package fr.esiag.isidis.pdsTeam.views;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.HashMap;
import java.util.Map;

import javax.swing.BoxLayout;
import javax.swing.JFrame;

import fr.esiag.isidis.pdsTeam.Data.ParserData;
import fr.esiag.isidis.pdsTeam.Data.ParserDataInitValue;
import fr.esiag.isidis.pdsTeam.Observer.TableObserver;
import fr.esiag.isidis.pdsTeam.beans.Train;

public class Frame{
	Map<Integer,TrainView> trains=new HashMap<Integer, TrainView>();
	Map<Integer,Train> trains2=new HashMap<Integer, Train>();
	Map<Integer,LigneView> lignesView=new HashMap<Integer, LigneView>();
	ParserData dataParser;
	public Frame(){
		ParserData parser=new ParserDataInitValue();
		parser.ReadData();
		trains=parser.getTrains();
		trains2=parser.getTrains2();
		lignesView=parser.getLignesView();
		JFrame frame=new JFrame("Reseau Terrain");
		Dimension screen= Toolkit.getDefaultToolkit().getScreenSize();
		frame.setSize(screen);
		frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
		ReseauTerrain reseauTerrain=new ReseauTerrain(trains,lignesView);
		reseauTerrain.setPreferredSize(new Dimension(1200,screen.width));
		TableObserver tableObserver=new TableObserver(trains);
		tableObserver.setPreferredSize(new Dimension(200,screen.width));
		frame.getContentPane().add(tableObserver);
		frame.getContentPane().add(reseauTerrain);
		frame.setVisible(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	public static void main(String[] args) {
		new Frame();
	}
}
